<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>

<html>
<head>
	<title>Listagem de Perfils</title>
</head>

<link href="../css/estilo.css" rel="stylesheet" type="text/css">

<body>
<f:view>
<%@ include file="Menu.jsp" %>

<rich:spacer height="20" />

<rich:panel header="Listagem de Perfils" headerClass="titulo">

		<rich:messages layout="table" infoLabelClass="messageInfo" errorLabelClass="messageError">
			<f:facet name="infoMarker">
				<h:graphicImage value="../imagens/sucesso.gif" />
			</f:facet>
			<f:facet name="errorMarker">
				<h:graphicImage value="../imagens/erro.gif" />
			</f:facet>
		</rich:messages>
		<rich:spacer height="30" />
		<h:form>
			<h:outputText>Nome: </h:outputText>
			<h:inputText id="Nome" value="#{perfilBean.desc }" size="30" />
			<h:message for="Nome" style="color: darkred"></h:message>			
			<br />		
			<rich:spacer height="30" />
			<rich:spacer width="40" />
			<h:commandButton value="Pesquisar" action="#{perfilBean.pesquisaPerfil}" />
			<rich:spacer width="5" />
			<h:commandButton value="Novo perfil" action="#{perfilBean.novo}"/>
			<br/>
		</h:form>
<h:form>
<rich:spacer height="20" />
	<rich:dataTable id="perfils" border="1" value="#{perfilBean.lista}" var="e"
	binding="#{perfilBean.objDataTablePerfil }" 
	rendered="#{not empty perfilBean.lista}" rows="5" width="98%">
		<h:inputHidden value="#{e.id_perfil}" />
		<f:facet name="header">
              	<h:outputText value="Perfis" />
        </f:facet>
		<h:column>
			<f:facet name="header">
				<h:outputText value="Nome" />
			</f:facet>
			<h:outputText value="#{e.nm_perfil}" styleClass="outputtext"/>	
		</h:column>
		<h:column headerClass="ultima_coluna">
			<f:facet name="header">
				<h:outputText value="Alterar" />
			</f:facet>
			<center><h:commandButton action="#{perfilBean.alterar}" image="../imagens/edit.gif" styleClass="botoesImgs" /></center>
		</h:column>
		<h:column headerClass="ultima_coluna">
			<f:facet name="header">
				<h:outputText value="Excluir" />
			</f:facet>
			<center>
			<a4j:commandButton value="excluir" image="../imagens/delete.gif" styleClass="botoesImgs"
							onclick="#{rich:component('conf')}.show();return false" />
			</center>
			<a4j:jsFunction name="excluir" action="#{perfilBean.excluir}"/>			
		</h:column>
		<f:facet name="footer">
			<rich:datascroller />
		</f:facet>
	</rich:dataTable>
</h:form>
</rich:panel>
<%@ include file="Modal.jsp"%>
</f:view>
</body>
</html>